home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Franz PD / Franz PD Disk #047 (1990)(Amiga User Group Deutschland e.V.)[v Disaster Master 2].zip / Franz PD Disk #047 (1990)(Amiga User Group Deutschland e.V.)[v Disaster Master 2].adf / A68K_Beispiele / request.asm < prev    next >
Assembly Source File  |  1989-07-02  |  10KB  |  335 lines

  1.  
  2. ***********************
  3. *
  4. * Send up a requester and wait until clicked
  5. *
  6. * === not reentrant, not multitasking simultaneous usable ===
  7. *
  8. * This implementation was written by:
  9. * E. Lenz
  10. * Johann-Fichte-Strasse 11
  11. * 8 Munich 40
  12. * Germany
  13. *
  14. ***********************
  15.  
  16. ; INPUT
  17. ;
  18. ; a0 = pointer to requester text 1st line
  19. ; a1 = pointer to requester text 2nd line (0 = no 2nd or 3rd line)
  20. ; a2 = pointer to requester text 3rd line (0 = no 3rd line)
  21. ; a3 = pointer to requester header
  22. ; a4 = pointer to gadget 1 text
  23. ; a5 = pointer to gadget 2 text (0 = no gadget 2)
  24.  
  25. ; INTERNAL
  26. ;
  27. ; d5 = Error flag
  28. ; a4 = IntuitionBase
  29. ; a5 = Window
  30.  
  31. ; OUTPUT
  32. ;
  33. ; d0 = the number of the selected gadget
  34. ; 0 = error occured  1 = 1st gadget selected  2 = 2nd gadget selected
  35.  
  36.        XDEF request
  37.  
  38. ; EXEC.library routines
  39.  
  40. _AbsExecBase       equ 4
  41. _LVOWait           equ -$13e
  42. _LVOGetMsg         equ -$174
  43. _LVOReplyMsg       equ -$17a
  44. _LVOWaitPort       equ -$180
  45. _LVOCloseLibrary   equ -$19e
  46. _LVOOpenLibrary    equ -$228
  47.  
  48. ; INTUITION.library routines
  49.  
  50. _LVOCloseWindow    equ -$48
  51. _LVOEndRequest     equ -$78
  52. _LVOOpenWindow     equ -$cc
  53. _LVORequest        equ -$f0
  54. _LVOWindowToFront  equ -$138
  55.  
  56. wd_UserPort equ $56
  57.  
  58. request      move.l  a0,Rtxt    set texts
  59.              move.l  a1,d0
  60.              lea     R2text(pc),a0
  61.              move.l  d0,R2txt
  62.              bne.s   is2
  63.              movea.l d0,a0
  64. is2          move.l  a0,next1
  65.              move.l  a2,d0
  66.              lea     R3text(pc),a0
  67.              move.l  d0,R3txt
  68.              bne.s   is3
  69.              movea.l d0,a0
  70. is3          move.l  a0,next2
  71.              move.l  a3,Wdname  set header
  72.              move.l  a4,Gag1
  73.              move.l  a5,d0
  74.              lea     Rgadg2(pc),a0
  75.              move.l  d0,Gag2
  76.              bne.s   endhead
  77.              movea.l d0,a0
  78. endhead      move.l  a0,Rgadget
  79.  
  80.              suba.l  a5,a5
  81.              movea.l _AbsExecBase,a6
  82.              lea     IntuitionName(pc),a1 Open intuition.library
  83.              moveq   #0,d0
  84.              jsr     _LVOOpenLibrary(a6)
  85.              movea.l d0,a4            Save intuition base address
  86.              tst.l   d0
  87.              beq.s   gexit
  88.  
  89. ; Open window
  90.  
  91.              movea.l d0,a6         Base address = IntuitionBase
  92.              lea     NewWindow(pc),a0
  93.              jsr     _LVOOpenWindow(a6)
  94.              movea.l d0,a5         Save pointer to window structure
  95.              tst.l   d0
  96. gexit        beq.s   exit
  97.  
  98.              lea     Request1(pc),a0   Send up requester
  99.              movea.l a5,a1
  100.              jsr     _LVORequest(a6)
  101.  
  102.              movea.l _AbsExecBase,a6
  103.  
  104. Reqwait      movea.l a5,a0
  105.              jsr     _LVOWindowToFront(a6)
  106.  
  107.              movea.l a5,a0
  108.              movea.l wd_UserPort(a0),a0  Load Window.UserPort
  109.              move.b  $f(a0),d1           Load signal bit
  110.              moveq   #1,d0
  111.              lsl.l   d1,d0
  112.              jsr     _LVOWait(a6)
  113.  
  114.              movea.l a5,a0
  115.              movea.l wd_UserPort(a0),a0  Reload Window.UserPort
  116.              jsr     _LVOGetMsg(a6)
  117.              tst.l   d0
  118.              beq.s   Reqwait       No message
  119.  
  120.              movea.l d0,a1
  121.              move.l  $14(a1),d7       Message in a7
  122.              jsr     _LVOReplyMsg(a6) Always reply
  123.  
  124.              movea.l a4,a6
  125.  
  126.              lea     Request1(pc),a0
  127.              movea.l a5,a1
  128.              jsr     _LVOEndRequest(a6)
  129.  
  130.              movea.l a5,a0            get gadget id
  131.              movea.l $5e(a0),a0
  132.              movea.l $1c(a0),a0
  133.              move.w  $26(a0),d5
  134.  
  135. exit         move.l  a5,d0              Close window
  136.              beq.s   No_Wind
  137.              movea.l d0,a0
  138.              jsr     _LVOCloseWindow(a6)
  139.  
  140.  
  141. ;Close library
  142.  
  143. No_Wind      movea.l _AbsExecBase,a6
  144.              move.l  a4,d0            Close intuition lib
  145.              beq.s   No_Intui
  146.              movea.l d0,a1
  147.              jsr     _LVOCloseLibrary(a6)
  148.  
  149. No_Intui     moveq   #0,d0
  150.              move.w  d5,d0
  151.              rts
  152.  
  153. IntuitionName dc.b 'intuition.library',0
  154.               even
  155.  
  156. ***** Window definition *****
  157.  
  158. NewWindow     dc.w 0,0           Position left,top
  159.               dc.w 319,72        Size width,height
  160.               dc.b 0,1           Colors detail-,block pen
  161.               dc.l $40           IDCMP-Flags
  162.               dc.l $1407         Window flags
  163.               dc.l 0             ^Gadget
  164.               dc.l 0             ^Menu check
  165. Wdname        dc.l 0             ^Window name
  166.               dc.l 0             ^Screen structure,
  167.               dc.l 0             ^BitMap
  168.               dc.w 88            MinWidth
  169.               dc.w 24            MinHeight
  170.               dc.w 319           MaxWidth
  171.               dc.w 72,1          MaxHeight,Screen type
  172.  
  173.  
  174. *** Requester definition ***
  175.  
  176. Request1      dc.l 0       Older request
  177.               dc.w 0       Left edge
  178.               dc.w 0       Top edge
  179.               dc.w 303     Width
  180.               dc.w 60      Height
  181.               dc.w 0,0     Rel -left,-top
  182.               dc.l Rgadget Gadget
  183.               dc.l Rborder Requester border
  184.               dc.l Rtext   Requester text
  185.               dc.w 0       Flags
  186.               dc.b 1,0     Backplane fill pen
  187.               dc.l 0       Requester layer
  188.               dc.l 0       Image bit map
  189.               ds.l 8
  190.               ds.l 1       Points back to window structure
  191.               ds.l 8
  192.  
  193. Rborder       dc.w 0       Left edge
  194.               dc.w 0       Top edge
  195.               dc.b 0,2     Front pen,back pen
  196.               dc.b 1,5     Draw mode,number of coord pairs
  197.               dc.l RPairs  Vector coordinate pairs
  198.               dc.l 0       Next border
  199.  
  200. RPairs        dc.w 2,1     Lines surrounding the requester
  201.               dc.w 293,1
  202.               dc.w 293,57
  203.               dc.w 2,57
  204.               dc.w 2,1
  205.  
  206. Rtext         dc.b 0       Front pen  (blue)
  207.               dc.b 1       Back pen   (white)
  208.               dc.b 0,0     Draw mode
  209.               dc.w 10      Left edge
  210.               dc.w 10      Top edge
  211.               dc.l 0       Text font
  212. Rtxt          ds.l 1       Pointer to text
  213. next1         dc.l 0       Next text
  214.  
  215. R2text        dc.b 0       Front pen  (blue)
  216.               dc.b 1       Back pen   (white)
  217.               dc.b 0,0     Draw mode
  218.               dc.w 10      Left edge
  219.               dc.w 20      Top edge
  220.               dc.l 0       Text font
  221. R2txt         ds.l 1       Pointer to text
  222. next2         dc.l 0       Next text
  223.  
  224. R3text        dc.b 0       Front pen  (blue)
  225.               dc.b 1       Back pen   (white)
  226.               dc.b 0,0     Draw mode
  227.               dc.w 10      Left edge
  228.               dc.w 30      Top edge
  229.               dc.l 0       Text font
  230. R3txt         dc.l 0       Pointer to text
  231.               dc.l 0       Next text
  232.  
  233. Rgadget       dc.l 0        +0 Next gadget
  234.               dc.w 10       +4 Left edge
  235.               dc.w -20      +6 Top edge
  236.               dc.w 50       +8 Width
  237.               dc.w 14       +A Height
  238.               dc.w 8        +C Flags
  239.               dc.w 1        +E Activation
  240.               dc.w 1        +10 Gadget type
  241.               dc.l Rbord1   +12 Rendered as border or image
  242.               dc.l 0        +16 Select render
  243.               dc.l Gag1txt  +1A ^Gadget text
  244.               dc.l 0        +1E Mutual exclude
  245.               dc.l 0        +22 Special info
  246.               dc.w 1        +26 Gadget ID
  247.                            ;+28 User data
  248.  
  249. Rbord1        dc.w 0       Left edge
  250.               dc.w 0       Top edge
  251.               dc.b 3,0     Front pen,back pen
  252.               dc.b 1,5     Draw mode,number of coord pairs
  253.               dc.l RPairs1 Vector coordinate pairs
  254.               dc.l Rbord2  Next border
  255.  
  256. RPairs1       dc.w 0,0     Lines which constitute the gadget
  257.               dc.w 50,0
  258.               dc.w 50,14
  259.               dc.w 0,14
  260.               dc.w 0,0
  261.  
  262. Rbord2        dc.w 0,0
  263.               dc.b 0,0
  264.               dc.b 1,5
  265.               dc.l RPairs2
  266.               dc.l 0
  267.  
  268. RPairs2       dc.w 2,2
  269.               dc.w 48,2
  270.               dc.w 48,12
  271.               dc.w 2,12
  272.               dc.w 2,2
  273.  
  274. Gag1txt       dc.b 0       Front pen  (blue)
  275.               dc.b 1       Back pen   (white)
  276.               dc.b 1,0     Draw mode
  277.               dc.w 8       Left edge
  278.               dc.w 4       Top edge
  279.               dc.l 0       Text font
  280. Gag1          dc.l 0       Pointer to text
  281.               dc.l 0       Next text
  282.  
  283.  
  284. Rgadg2        dc.l 0        +0 Next gadget
  285.               dc.w -68      +4 Left edge
  286.               dc.w -20      +6 Top edge
  287.               dc.w 50       +8 Width
  288.               dc.w 14       +A Height
  289.               dc.w $18      +C Flags
  290.               dc.w 1        +E Activation
  291.               dc.w 1        +10 Gadget type
  292.               dc.l Rbord21  +12 Rendered as border or image
  293.               dc.l 0        +16 Select render
  294.               dc.l Gag2txt  +1A ^Gadget text
  295.               dc.l 0        +1E Mutual exclude
  296.               dc.l 0        +22 Special info
  297.               dc.w 2        +26 Gadget ID
  298.                            ;+28 User data
  299.  
  300. Rbord21       dc.w 0       Left edge
  301.               dc.w 0       Top edge
  302.               dc.b 3,0     Front pen,back pen
  303.               dc.b 1,5     Draw mode,number of coord pairs
  304.               dc.l RPair21 Vector coordinate pairs
  305.               dc.l Rbord22 Next border
  306.  
  307. RPair21       dc.w 0,0     Lines which constitute the gadget
  308.               dc.w 50,0
  309.               dc.w 50,14
  310.               dc.w 0,14
  311.               dc.w 0,0
  312.  
  313. Rbord22       dc.w 0,0
  314.               dc.b 0,0
  315.               dc.b 1,5
  316.               dc.l RPair22
  317.               dc.l 0
  318.  
  319. RPair22       dc.w 2,2
  320.               dc.w 48,2
  321.               dc.w 48,12
  322.               dc.w 2,12
  323.               dc.w 2,2
  324.  
  325. Gag2txt       dc.b 0       Front pen  (blue)
  326.               dc.b 1       Back pen   (white)
  327.               dc.b 1,0     Draw mode
  328.               dc.w 8       Left edge
  329.               dc.w 4       Top edge
  330.               dc.l 0       Text font
  331. Gag2          dc.l 0       Pointer to text
  332.               dc.l 0       Next text
  333.  
  334.               end
  335.